Skip to content

Fix for Empty except#817

Merged
Andrey1994 merged 1 commit intomasterfrom
finding-autofix-063dfacb
Apr 26, 2026
Merged

Fix for Empty except#817
Andrey1994 merged 1 commit intomasterfrom
finding-autofix-063dfacb

Conversation

@Andrey1994
Copy link
Copy Markdown
Member

General fix: replace bare except: + pass with targeted exception handling and an explanatory comment, so only expected failures are ignored.

Best fix here (without changing behavior): in python_package/brainflow/ml_model.py, inside MLModuleDLL.__init__, change:

  • except: to except (AttributeError, OSError):
  • keep pass but add a clear explanatory comment stating why it is safe to continue.

Why these exceptions:

  • AttributeError: os.add_dll_directory may not exist on some Python/platform combinations.
  • OSError: call can fail depending on runtime environment/permissions/path handling.

No imports or new methods are needed.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@Andrey1994 Andrey1994 marked this pull request as ready for review April 26, 2026 22:32
@Andrey1994 Andrey1994 merged commit 03dc022 into master Apr 26, 2026
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant